<?php
namespace application\admin\controllers;

use mz\controllers\AdminController;
use Yii;

class ErrorController extends AdminController
{
    public $layout = false;

    public function preFilters($action)
    {
        return [];
    }

    public function actionIndex()
    {
        $e = Yii::$app->errorHandler->exception;
        if ($e !== null) 
        {
            $code = $e->getCode();
//            var_dump($code);exit();
            if (!$code && isset($e->statusCode)) {
                $code = $e->statusCode;
            }
            $name = 'Error';
            $message = $e->getMessage();
            $data = [ 'code' => $code, 'name'=> $name, 'message'=> $message ];
            return $this->render('index', $data); 
        }
    }
}
